package main

import (
	"encoding/json"
	"fmt"
)

type Classes struct {
	Age int `json:"age"`
}

type Students struct {
	Classes `json:"classes"`
	Name    string `json:"name"`
	Sex     string `json:"sex"`
}

func main() {
	c := Classes{Age: 22}
	s := Students{Sex: "男", Name: "姓名", Classes: c}
	v, err := json.Marshal(s)

	if err != nil {
		fmt.Println(err)
	}
	fmt.Printf(string(v))

}
